<template>
  <div class="home-favorite-item">
    <div>
      <span class="channel-icon" :style="{'background-image': 'url(' + channel.icon + ')'}"></span>
      <div class="channel-info">
        <p class="channel-name">{{channel.name}}</p>
        <p v-if="channel.url" class="channel-link">{{channel.url}}</p>
      </div>
    </div>
    <div>
      <button class="btn" @click="clickHandler">{{channel.btnText}}</button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'home-favorite-item',

  props: {
    channel: {
      type: Object,
      required: true
    }
  },

  methods: {
    clickHandler () {
      this.$emit('on-click');
    }
  }
};
</script>

<style lang="scss" scoped>
@import "~@/assets/css/mixins";

.home-favorite-item {
  display: flex;
  justify-content: space-between;
  height: 72px;
  margin-bottom: 24px;
  padding: 0 40px;

  &:last-of-type {
    margin-bottom: 0;
  }

  & > div:first-of-type {
    display: flex;
    align-items: center;
  }

  .channel-icon {
    display: inline-block;
    vertical-align: bottom;
    margin-right: 24px;
    width: 72px;
    height: 72px;
  }

  .channel-info {

    .channel-name {
      margin-bottom: 8px;
      height: 37px;
      line-height: 37px;
      font-size: 28px;
      color: #8974AC;
    }

    .channel-link {
      width: 277.5px;
      height: 31px;
      line-height: 31px;
      font-size: 24px;
      color: rgba(137, 116, 172, 0.6);
      @include ellipsis(277.5px);
    }
  }

  .btn {
    padding: 16px 44px;
    line-height: 29px;
    font-size: 24px;
    color: #AA8AFF;
    background: transparent;
    outline: none;
    border: 2px solid #AA8AFF;
    border-radius: 75px;
  }
}
</style>
